package com.diko.excel;

import com.alibaba.excel.EasyExcel;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Emma Li
 * @date 2020/9/23 - 15:44
 */
public class testEasyExcel {
    public static void main(String[] args) {
        String fileName="F:\\11.xlsx";
        EasyExcel.write(fileName,DemoData.class).sheet("学生编号").doWrite(data());
    }

    @Test
    public void read(){
        String fileName="F:\\11.xlsx";

        EasyExcel.read(fileName,DemoData.class,new ExcelListener()).sheet().doRead();
    }
    private static List<DemoData> data(){
        List<DemoData> list = new ArrayList<>();
        for(int i=0;i<10;i++){
            DemoData data = new DemoData();
            data.setSno(i);
            data.setSname("Emma"+i);
            list.add(data);
        }
        return list;
    }
}
